namespace IMPlant.Core.Data.Ado.Action
{
    using IMPlant.Core.Data.Ado.BaseSupport;
    using IMPlant.Core.Data.DataInterface;
    using System;
    using System.Collections;
    using System.Data;
    using System.Data.Common;
    using System.Runtime.InteropServices;

    public class ExcuteList<T> : CommandAction
    {
        private AutoOrm orm;

        public ExcuteList(CommandType type, string text, DbParameter[] paras)
        {
            this.orm = new AutoOrm();
            base.type = type;
            base.commandText = text;
            base.parameters = paras;
        }

        public override object DoInCommand(DbCommand cmm)
        {
            IDataReader reader = null;
            object obj3;
            IList list = new ArrayList();
            try
            {
                reader = cmm.ExecuteReader();
                while (reader.Read())
                {
                    object obj2 = this.orm.MapRow<T>(reader);
                    list.Add(obj2);
                }
                obj3 = list;
            }
            catch
            {
                throw;
            }
            finally
            {
                if (!reader.IsClosed)
                {
                    reader.Close();
                }
            }
            return obj3;
        }
    }
}

